package com.jt.redis.system.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jt.redis.system.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT id,username,password,status FROM tb_users WHERE username = #{username}")
    User selectUserByUsername(String username);
    @Select("SELECT m.`permission` FROM tb_menus m JOIN tb_role_menus rm " +
            "ON m.`id`=rm.`menu_id` JOIN tb_user_roles ur " +
            "ON ur.`role_id`=rm.`role_id` WHERE user_id = #{userId}")
    List<String> selectUserPermissions(Long userId);
}
